package strcy.cn.market.controller;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import strcy.cn.market.utils.QiNiuOSSUtil;
import strcy.cn.market.utils.Result;

import java.io.IOException;

@RestController
public class FileUploadController {

    @Autowired
    private QiNiuOSSUtil qiNiuOSSUtil;

    @PostMapping("/upload")
    public Result<String> upload(MultipartFile file) throws IOException {
        String url = qiNiuOSSUtil.upload(file);
        return Result.success(url);
    }
}
